<template>
    <div class="event-detail" style="background-color: palegoldenrod; height: 800px">
      <!-- 事件申请标题 -->
      <h2 class="event-title" style="text-align: center;">{{ event.title }}</h2>
      <!-- 事件申请时间 -->
      <div class="event-time" style="opacity: 0.5; text-align: center;">{{ event.time }}</div>
      <!-- 事件申请内容 -->
      <div class="event-content" style="text-indent: 2em; font-size: larger;">{{ event.content }}</div>
      <!-- 事件申请附件 -->
      <div class="event-attachment" v-if="event.attachment">
        <el-divider>附件下载</el-divider>
        <div @click="downFile"><i class="el-icon-document"></i>{{ event.attachment }}</div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        event: {}
      };
    },
    created() {
      // 获取事件申请详情
      this.geteventDetail();
    },
    methods: {
      // 获取事件申请详情
      geteventDetail() {
        this.request.get('/event/detail/' + this.$route.params.id)
          .then(response => {
            this.event = response.data.data.list;
          })
          .catch(error => {
            console.error(error);
          });
      },
      downFile() {
      alert("开始下载")
      var url = "http://localhost:8086/downloadFile?filePath=" + this.event.attachment
      window.open(url)
    }
    }
  };
  </script>
  